<!DOCTYPE html>
<html>
<head>
<title>{$site_name}</title>
<meta name="keywords" content="{$site_seo_keywords}" />
<meta name="description" content="{$site_seo_description}">
<meta name="author" content="ThinkCMF">
<tc_include file="Public:head" />
</head>
<body class="body-white" id="top">
	<tc_include file="Public:nav" />

		<div class="container tc-main">
                <div class="row">
                    <div class="span3">
	                    <tc_include file="Public:usernav"/>
                    </div>
                    <div class="span9">
                           <div class="tabs">
                               <ul class="nav nav-tabs">
                                   <li class="active"><a href="#one" data-toggle="tab"><i class="fa fa-list-alt"></i> 提现</a></li>
                               </ul>
                               <div class="tab-content">
                                   <div class="tab-pane active" id="one">
                                   	
												<p><i></i>请输入您要提现的金额，以及正确无误的银行帐号信息。</p>
												<p><i></i>我们将在7个工作日（双休日和法定节假日除外）之内，将钱转入您指定的银行帐号 。</p>
												<p><i></i>在双休日和法定节假日期间，用户可申请取现，但必须等恢复正常上班之后才进行处理。不便之处，请多多谅解！
												</p>
												<p class="f_red" style="color:red;"><i></i>
										重要！！推荐银行（即下拉菜单中可直接选择的银行）不需要填写开户行支行信息，不在此列的其他银行则需要您填写开户行支行信息。如果您填写的开户行支行不正确，提现交易将无法成功，提现费用不予返还。如果您不确定开户行支行名称，可以打电话到当地所在银行的营业网点询问或者上网查询。
										警告：禁止信用卡套现、虚假交易等行为，一经确认，将终止该账户的使用。
												</p>
									
									
                                   		<form class="form-horizontal " action="{:U('User/Money/savecarry')}" method="post">
                                   			
											<div class="total clearfix">
												
												<div class="f_l pl10">累计提现金额：{$carry}元    （备注：不含手续费，为实际到帐金额。{$ralProportion}积分等于1元）</div>
											</div>
											<style type="text/css">
													
														.total{ border-bottom:dotted 1px #400040; border-top:dotted 1px #400040; line-height:60px; height:60px; margin-bottom20px;}
														.f_red{ color:red; padding:10px;}
											</style>
											<php> $cmoney=floor($money['available_funds']/$ralProportion);
											</php>
											<div class="blank20"></div>
													<div class="control-group">
                                   					<label class="control-label" for="input-password">可提现金额：</label>
													<div class="controls" style="line-height:30px;">
														
														{$cmoney}元
														<input id="Jcarry_totalAmount" type="hidden" value="{$cmoney}">
													
													</div>
													</div>
												<div class="control-group">
                                   					<label class="control-label" for="input-password"><span class="f_red b">*</span>提现金额：</label>
													<div class="controls">
													
														<input id="Jcarry_amount" class="f-input span2" type="text" name="amount" autocomplete="off">元
													
												
													</div>
													
													<label class="control-label" ><span class="f_red b">*</span>提现费用：</label>
													<div class="controls" style="line-height:30px;">
														<span id="Jcarry_fee">0.00 元</span>
													</div>
													
													<label class="control-label" ><span class="f_red b">*</span>实付金额：</label>
													<div class="controls" style="line-height:30px;">
														<span id="Jcarry_realAmount">0.00 元</span>
													</div>
													<label class="control-label" ><span class="f_red b">*</span>提现后可用余额：</label>
													<div class="controls" style="line-height:30px;">
														<span id="Jcarry_acount_balance">{$cmoney} 元</span>
													</div>
													<label class="control-label" ><span class="f_red b">*</span>开户行：</label>
													<div class="controls" style="line-height:30px;">
														<span>{$bank.bank_name}    
															<a href="{:U('User/money/index',array('act'=>'bank'))}">我想重新选择</a>
														</span>
													</div>
													<label class="control-label" ><span class="f_red b">*</span>开户名：</label>
													<div class="controls" style="line-height:30px;">
														<span>
														{$bank.real_name}
														</span>
													</div>
													
													
													<label class="control-label" ><span class="f_red b">*</span>卡号：</label>
													<div class="controls" style="line-height:30px;">
														<span>
														{:substr($bank['bankcard'],0,4)}  {:substr($bank['bankcard'],4,4)}****
														</span>
													</div>
						<if condition="$sys_withdrawalSMSvalidation eq 1">
						<label class="control-label" ><span class="f_red b">*</span>短信验证码：</label>
						<div class="controls" style="line-height:30px;">
							<span>
								<input id="J_PAYPASSWORD" class="f-input" type="password" name="phone_paypassword" autocomplete="off">
							</span>
							<span>
	<input type="button" id="reveiveActiveCode"  class="reveiveActiveCode" value="免费获取验证码" >
	                        </span>
						</div>
						</if>
						<br><br>
						<div class="controls" style="line-height:30px;">
						<input type="hidden" value="{$bank.id}" name="bank_id">
						<input id="fee_money" type="hidden" value="0" name="fee_money">
							<input class="sub_btn" type="button" value="申请提现">								
						</div>
						</div>
									
									
									
                     </form>
                                   </div>
                               </div>							
                           </div>
                    </div>
                </div>

		<tc_include file="Public:footer" />

	</div>
	<!-- /container -->

	<tc_include file="Public:scripts" />
	<script type="text/javascript">
	jQuery(function(){
		//获取手机验证码
		$("#reveiveActiveCode").attr("disabled","");//按钮变亮
		$("#reveiveActiveCode").click(function(){
			var obj = $(this);
			var query = new Object();
			//query.id = $(this).attr("dataid");

				$.ajax({
					url:"{:U('User/Myaccount/authma')}",
					data:query,
					type:"post",
					dataType:"json",
					success:function(result){
						if(result.status==1)
						{
							settime(obj);
						}else if(result.status==-1){
							$.showErr(result.info);
						}else if(result.status==-2){
							$.showErr(result.info);
						}
					},
					error:function(){
						$.showErr("发生错误");
					}
				});
		});

		var countdown=60;
		function settime(val) {
			if (countdown == 0) {
				val.attr("disabled","");
				val.val("免费获取验证码");
				countdown=60;
			} else {
				val.attr("disabled","disabled");
				val.val("(" + countdown + ")后重新发送");
				countdown--;
			}
			if(val.val()!="免费获取验证码"){
				setTimeout(function() {
					settime(val)
				},1000);
			}
		}
		
		
		$("#Jcarry_amount").keyup(function(){
			carry();
		});
		
		$(".sub_btn").live("click",function(){
			if(!carry()){  return false;}

			$("form").submit();
		});
		
	});
	function carry(){
		var obj = $("#Jcarry_amount");
		var money = {$cmoney};//可用金额
		var y_fee = {$money.withdrawalfrees};//已用免费额度
		var m_fee = {$m_fee};//免费额度
		var s_fee = {$s_fee};//上线
		var x_fee = {$x_fee};//下线
		var l_fee = {$l_fee};//费率
		var fee = {$fee};//是否收费
		var t_money = obj.val();//提现金额
		
		if(!($("input[name='amount']").val()!=''&&!isNaN($("input[name='amount']").val())&&$("input[name='amount']").val()>0))			
		{
			$.showErr("请输入正确的充值金额");
			return false;
		}
		
		//收费
		if(fee){
			//提现费用
			var feiyong = 0;
			if(Number(y_fee)+Number(t_money) > Number(m_fee)){
				 feiyong = (Number(y_fee)+Number(t_money)-Number(m_fee))*(Number(l_fee)/100);
				if(feiyong<1){
					 feiyong = 1;
				}else if(feiyong>50){
					 feiyong = 50;
				}
			}
			//alert(feiyong);
			//实付金额
			var shi_money = Number(t_money) + Number(feiyong);
			//alert(shi_money);
			//提现后账户可用余额
			var k_money = Number(money)-Number(shi_money);
			
			if(shi_money>money){
				$.showErr("您可用资金不足");
				return false;
			}
		
			$("#Jcarry_fee").text(Number(feiyong).toFixed(2)+"元");
			$("#fee_money").val(Number(feiyong).toFixed(2));
			$("#Jcarry_realAmount").text(Number(shi_money).toFixed(2)+"元");
			$("#Jcarry_acount_balance").text(Number(k_money).toFixed(2)+"元");
		}else{
			if(t_money>money){
				$.showErr("您可用资金不足");
				return false;
			}
			
			//提现后账户可用余额
			var k_money = money - t_money;
			$("#Jcarry_realAmount").text(Number(t_money).toFixed(2)+"元");
			$("#Jcarry_acount_balance").text(Number(k_money).toFixed(2)+"元");
		}
		return true;
	}

</script>
	
</body>
</html>